package com.example.yoho.mvp.view.adapter;

import android.support.annotation.Nullable;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.yoho.R;
import com.example.yoho.mvp.model.entity.BrandListEntity;
import com.example.yoho.mvp.model.entity.BrandPageEntity;

import java.util.List;

public class MyBrandListAdapter extends BaseMultiItemQuickAdapter<BrandPageEntity, BaseViewHolder> {


    /**
     * Same as QuickAdapter#QuickAdapter(Context,int) but with
     * some initialization data.
     *
     * @param data A new list is created out of this one to avoid mutable list
     */
    public MyBrandListAdapter(List<BrandPageEntity> data) {
        super(data);
        addItemType(1, R.layout.brandlistletter_item);
        addItemType(2, R.layout.brandlist_item);

    }

    @Override
    protected void convert(BaseViewHolder helper, BrandPageEntity item) {
        Log.e(TAG, "convert: 123"+item.getHot_tag() );
        switch (helper.getItemViewType()) {
            case 1:
                helper.setText(R.id.tv_letter, item.getBrand_letter());
                break;
            case 2:
                TextView textView_hot = helper.getView(R.id.tv_hots);
                helper.setText(R.id.brandlist_tv, item.getBrand_name());
                Log.e(TAG, "convert: " + item.getBrand_name());

                Log.e(TAG, "convert: " + item.getHot_tag());
                if (Boolean.valueOf(item.getHot_tag())) {
                    textView_hot.setVisibility(View.VISIBLE);
                } else {
                    textView_hot.setVisibility(View.GONE);
                }
                break;

        }
    }
}
